package com.sky.mapper.admin;

import com.sky.pojo.DishFlavor;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    /**
     * 插入菜品口味
     * @param flavors
     */
    void insertBatch(List<DishFlavor> flavors);

    /**
     * 删除口味表
     * @param ids
     */
    void deleteByDishIds(@Param("ids") List<Integer> ids);


    /**
     * 查询菜品对应口味
     * @param dishId
     * @return
     */
    @Select("select * from dish_flavor where dish_id=#{dishId};")
    List<DishFlavor> getFlavorById(Long dishId);

    /**
     * 删除菜品对应口味
     * @param dishId
     */
    @Delete("delete from dish_flavor where dish_id=#{dishId} ")
    void deleteByDishId(Long dishId);

    /**
     * 菜品起售停售
     * @param status
     * @param id
     */
    @Update("update dish set status=#{status} where id=#{id}")
    void updateDishStatus(Integer status, Long id);


    /**
     * 根据菜品id查询对应的全部口味
     * @param id
     * @return
     */
    @Select("select * from dish_flavor where dish_id=#{id};")
    List<DishFlavor> getFlavorByDishId(Long id);
}
